package cn.xiongxf.util;

/**
 *
 * @ClassName: AjaxResult
 * @Description: TODO(封装异步操作增删改之后的返回结果)
 * @author xiongxf
 * @version V1.0.0
 * @date 2022-08-09
 */
public class AjaxResult {

    private Boolean success = true;
    private String message = "操作成功";
    private Object resultObj;

    public AjaxResult(Boolean success, String message) {
        this.success = success;
        this.message = message;
    }
    public AjaxResult(){}

    // 链式语法改造
    public static AjaxResult me(){
        return new AjaxResult();
    }
    public Boolean getSuccess() {
        return success;
    }
    // 链式语法改造
    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }
    public String getMessage() {
        return message;
    }
    // 链式语法改造
    public AjaxResult setMessage(String message) {
        this.message = message;
        return this;
    }

    public Object getResultObj() {
        return resultObj;
    }

    public AjaxResult setResultObj(Object resultObj) {
        this.resultObj = resultObj;
        return this;
    }

    @Override
    public String toString() {
        return "AjaxResult [success=" + success + ", message=" + message + "]";
    }

	/*public static void main(String[] args) {
		System.out.println(AjaxResult.me());
		System.out.println(AjaxResult.me().setSuccess(false).setMessage("操作失败").setResultObj("呵呵"));
	}*/

}
